(deftemplate Animal
    (slot nume)
    (slot nutrimente) 
    (slot mod_de_viata) 
    (slot mediu_de_viata)
    (slot reproducere)
    (slot caracteristici)
    (slot regim_alimentar)
    (slot zona)
    )

(assert(Animal(nume Iepure)(nutrimente morcov)(mod_de_viata diurn)(mediu_de_viata terestru)(reproducere pui_vii)(caracteristici blana)(regim_alimentar vegetarian)))

(assert(Animal(nume Rechin)(nutrimente carne)(mod_de_viata diurn)(mediu_de_viata acvatic)(reproducere oua)(caracteristici solzi)(regim_alimentar carnivor)))

(assert(Animal(nume Peste)(nutrimente alge)(mod_de_viata diurn)(mediu_de_viata acvatic)(reproducere oua)(caracteristici solzi)(regim_alimentar vegetarian)(zona mediteraneana)))

(assert(Animal(nume Urs)(nutrimente miere)(mod_de_viata diurn)(mediu_de_viata terestru)(reproducere pui_vii)(caracteristici blana)(regim_alimentar carnivor)))

(assert(Animal(nume Bufnita)(nutrimente insecte)(mod_de_viata nocturi)(mediu_de_viata aerian)(reproducere oua)(caracteristici pene)(regim_alimentar vegetarian)))

(assert(Animal(nume Lup)(nutrimente carne)(mod_de_viata nocturn)(mediu_de_viata terestru)(reproducere pui_vii)(caracteristici blana)(regim_alimentar carnivor)))

(assert(Animal(nume Oaie)(nutrimente iarba)(mod_de_viata diurn)(mediu_de_viata terestru)(reproducere pui_vii)(caracteristici blana)(regim_alimentar vegetarian)))

(facts)

;regula 1 - determinarea animalelor care traiesc in mediul acvatic
(printout t "***************************REGULA1*******************"crlf)
(defrule regula1
    (Animal(nume ?x)(mediu_de_viata acvatic))
    =>
    
     (printout t "Animalul " ?x  " traieste in mediul de viata acvatic" crlf)
    )


(run)
 (printout t "***************************REGULA2*******************"crlf)
(defrule regula2
    (Animal(nume ?x)(zona mediteraneana)(regim_alimentar vegetarian))
    =>
   
     (printout t "Animalul " ?x  " are regim alimentar vegetarian" crlf)
    )
(run)

 (printout t "***************************REGULA3*******************"crlf)
(defrule regula3
     (Animal(nume ?y)(regim_alimentar carnivor))
     (Animal(nume ?x)(regim_alimentar vegetarian))
    =>
     (printout t " ( " ?y " , " ?x " ) " crlf)
    )


(run)
(agenda)
